package com.youyiwen.Controller;

import com.youyiwen.Bean.Question;
import com.youyiwen.Service.QuestionService;
import com.youyiwen.dto.PageInitDTO;
import com.youyiwen.dto.QuestionDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Author: zhaoyang
 * @Date: 2021/03/20
 */
@Controller
public class CommunityController {

    @Autowired
    QuestionService questionService;

    @GetMapping("/communityCenter")
    public String community(Model model,
                            @RequestParam(name = "page",defaultValue = "1") Integer page,
                            @RequestParam(name = "size",defaultValue = "10") Integer size){

        PageInitDTO dto = questionService.questionList(page,size);
        model.addAttribute("pageInitDTO",dto);


        return "communityCenter";
    }

}
